﻿@model KPIS.GERP.Models.ICM.PurchaseRequestItem

@if (ViewContext.RouteData.Values["action"].ToString().ToLower() == "edit")
{
@Html.HiddenFor(model => model.PrItemId)
}
@Html.HiddenFor(model => model.PrId)
@try
{
    @Html.HiddenFor(model => model.BgExpId)
} catch
{
}
@Html.HiddenFor(model => model.HaveItem)
@Html.HiddenFor(model => model.ResItemId)
@Html.HiddenFor(model => model.CreatedBy)
@Html.HiddenFor(model => model.CreatedWhen)
@Html.HiddenFor(model => model.UpdatedBy)
@Html.HiddenFor(model => model.UpdatedWhen)
@Html.HiddenFor(model => model.RecordStatus)
@*@Html.HiddenFor(model => model.RegularId, new { id="hRegularId" })
@Html.HiddenFor(model => model.BgSourceId, new { id="hBgSourceId" })
@Html.HiddenFor(model => model.BgExpId, new { id="hBgExpId" })*@

@{
    var serviceProjectOperation = new KPIS.GERP.WEB.GIMS.ProjectOperationService.ProjectOperationServiceClient();
    var serviceResource = new KPIS.GERP.WEB.GIMS.MasResourceService.MasResourceServiceClient();
    
    var newList = new List<SelectListItem>();
    var newItem = new SelectListItem() { Value = "", Text = "" };
    newList.Add(newItem);
    
    bool bEdit = ViewContext.RouteData.Values["action"].ToString().ToLower() == "edit";
}

<div class="clearfix">
    <div class="row-fluid">
        <div class="span6"><h4 class="text-info">เลือกรายการที่ต้องการ @ViewBag.PcTypeName</h4></div>
        <div class="span6"><h4 class="text-error pull-right">@ViewBag.YearTypeName @ViewBag.BgYear</h4></div>
    </div>
    <div class="row-fluid">
        <div class="control-group">
            <div class="control-label">
                ระบุพัสดุที่ซื้อ/จ้างทำ
            </div>
            <div class="controls-detail" style="margin-top:5px !important;">
                @((Model.HaveItem ?? true) ? "ระบุ" : "ไม่ระบุ")
            </div>
        </div>

        @if (Model.HaveItem ?? true)
        {
            <div class="control-group">
                <div class="control-label">
                    ประเภทพัสดุ
                </div>
                <div class="controls-detail" style="margin-top:5px !important;">
                    @Html.DisplayFor(m=>m.MasResourceItem.MasResourceSubGroup.MasResourceGroup.MasResourceType.Name)
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    หมวดพัสดุ
                </div>
                <div class="controls-detail" style="margin-top:5px !important;">
                    @Html.DisplayFor(m=>m.MasResourceItem.MasResourceSubGroup.MasResourceGroup.Name)
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    กลุ่มพัสดุ
                </div>
                <div class="controls-detail" style="margin-top:5px !important;">
                    @Html.DisplayFor(m=>m.MasResourceItem.MasResourceSubGroup.Name)
                </div>
            </div>
            <div class="control-group">
                <div class="control-label">
                    รายการพัสดุ
                </div>
                <div class="controls-detail" style="margin-top:5px !important;">
                    @Html.DisplayFor(m=>m.MasResourceItem.Name)
                </div>
            </div>
        }

        <hr />
        <div class="control-group">
            <div class="control-label">
                รายละเอียด
            </div>
            <div class="controls">
                @Html.TextAreaFor(model => model.Descr, new { id="lblDescr", @class="input-xlarge" })
                @Html.ValidationMessageFor(model => model.Descr)
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                จำนวน
            </div>
            <div class="controls">
                @Html.TextBoxFor(model => model.Qty, new { id="lblQty", @class="input-mini" })
                @Html.TextBoxFor(m => m.MasResourceItem.MasUnit.Name, new { id="lblUnitName", @readonly="true", style="color: #669fc7" })
                @*<input id="lblUnitName" type="text" readonly="true" style="color: #669fc7" />*@
                @Html.ValidationMessageFor(model => model.Qty)
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                ราคาแนะนำต่อหน่วย
            </div>
            <div class="controls">
                @Html.TextBoxFor(model => model.StdPrice, new { id="lblStdPrice", @readonly="true" }) บาท
                @Html.ValidationMessageFor(model => model.StdPrice)
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                ราคาต่อหน่วย
            </div>
            <div class="controls">
                @Html.TextBoxFor(model => model.Price, new { id="lblPrice" }) บาท
                @Html.ValidationMessageFor(model => model.Price)
            </div>
        </div>
        <div class="control-group">
            <div class="control-label">
                รวมราคา
            </div>
            <div class="controls">
                @Html.TextBoxFor(model => model.Amount, new { id="lblAmount" }) บาท
                @Html.ValidationMessageFor(model => model.Amount)
            </div>
        </div>
    </div>
</div>